﻿using Sui.Domain.Domain;
using Dotnet.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sui.Domain.Repository
{
    public class ColsRepository : RepositoryBase<ColsEntity>, IColsRepository
    {
        public ColsRepository(DbConnection conn) : base(conn)
        {

        }
        public override int Update(ColsEntity entity)
        {
            ColsEntity localEntity= dbcontext.Set<ColsEntity>().Local.FirstOrDefault(t => t.id == entity.id);
            if (localEntity == null)
            {
                return base.Update(entity);
            }
            else
            {
                dbcontext.Entry<ColsEntity>(localEntity).State = EntityState.Detached;
                return base.Update(entity);
            }
        }
    }





}
